package com.example.product.feign;

import com.example.common.to.SkuReductionTo;
import com.example.common.to.SpuBoundTo;
import com.example.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient("gmall-coupon")
public interface CouponFeignService {

    /**
     * 调用流程：
     * 1. 将@RequestBody标注的参数对象SpuBoundTo转为json
     * 2. 在注册中心找到gmall-coupon服务，给/coupon/spubounds/save发送请求
     * 将上一步的json放在请求体，发送数据
     * 3. 对方服务收到请求后，将请求体的json转为SpuBoundsEntity
     * 只要json数据模型字段一样，双方服务无需使用同一个参数对象
     * @param spuBounds
     * @return
     */
    @RequestMapping("/coupon/spubounds/save")
    R  save(@RequestBody SpuBoundTo spuBounds);

    @RequestMapping("/coupon/skufullreduction/saveInfo")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
